package com.example.metadata.service;

import com.example.metadata.domain.MetaDatabase;
import com.example.metadata.repository.MetaDataBaseRepository;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

@Service
public class MetaBaseService {

    private final MetaDataBaseRepository metaDataBaseRepository;

    public MetaBaseService(MetaDataBaseRepository metaDataBaseRepository) {
        this.metaDataBaseRepository = metaDataBaseRepository;
    }

    @Transactional(rollbackOn = Exception.class)
    public void save(MetaDatabase metaDataBase){
        metaDataBaseRepository.save(metaDataBase);
    }


    public Iterable<MetaDatabase> query(){
        return metaDataBaseRepository.findAll();
    }
}
